<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

    <head>
        <title>系统维护管理</title>
        <%-- 全站样式 --%>
        <jsp:include page="/WEB-INF/jsps/template_style.jsp"></jsp:include>
        <style type="text/css">
        	th,tr,td{
        		text-align: center;
        	}
        </style>
    </head>

    <body class="page-body skin-navy">
        <div class="page-container">
           <%--侧边栏 --%>
		<jsp:include page="/WEB-INF/jsps/sidebar.jsp"></jsp:include>
            <div class="main-content">
                <%--导航栏 --%>
				<jsp:include page="/WEB-INF/jsps/navbar.jsp"></jsp:include>

                <div class="page-title">
                    <div class="title-env">
                        <h1 class="title">系统维护管理</h1>
                        <p class="description">您可以在此页面对系统进行数据库备份和恢复</p>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-12">

                        <ul class="nav nav-tabs">
                            <li class="active">
                                <a href="#home" data-toggle="tab">
                                    <span class="visible-xs"><i class="fa-home"></i></span>
                                    <span class="hidden-xs">系统恢复信息列表</span>
                                </a>
                            </li>
                            <li>
                                <a href="#profile" data-toggle="tab">
                                    <span class="visible-xs"><i class="fa-user"></i></span>
                                    <span class="hidden-xs">系统备份信息列表</span>
                                </a>
                            </li>
                        </ul>

                        <div class="tab-content">
                            <div class="tab-pane active" id="home">

                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        <h3 class="panel-title">系统恢复列表</h3>
                                    </div>
                                    <div class="panel-body">
                                    

                                        <table class="table table-striped table-bordered" id="example-3">
                                            <thead>
                                                <tr class="replace-inputs">
                                                    <th width="15%">编号</th>
                                                    <th>恢复名称</th>
                                                    <th>恢复内容</th>
                                                    <th>恢复描述</th>
                                                    <th>恢复时间</th>
                                                </tr>
                                            </thead>
                                            <tbody>

                                                 <c:forEach var="maintenance" items="${maintenances }">
                                                	<c:if test="${maintenance.maintenanceType == '1' }">
				                                    	<tr>
				                                            <td>${maintenance.ID }</td>
				                                            <td>${maintenance.maintenanceName }</td>
				                                            <td>${maintenance.maintenanceContent }</td>
				                                            <td>${maintenance.maintenanceDescribe }</td>
				                                            <td>${maintenance.maintenanceTime }</td>
				                                    	 </tr>
				                                     </c:if>
			                                    </c:forEach>
                                                
                                            </tbody>
                                            <tfoot>
                                                <tr>
                                                    <th>编号</th>
                                                    <th>恢复名称</th>
                                                    <th>恢复内容</th>
                                                    <th>恢复时间</th>
                                                    <th>操作</th>
                                                </tr>
                                            </tfoot>
                                        </table>

                                    </div>
                                </div>

                            </div>
                            <div class="tab-pane" id="profile">
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        <h3 class="panel-title">系统备份列表</h3>
                                        <div class="fa-hover pull-right">
                                            <a href="javascript:;" onclick="jQuery('#modal-8').modal('show', {backdrop: 'fade'});">
                                                <i class="fa fa-files-o"></i>
                                                <span>备份文件</span>
                                            </a>
                                        </div>
                                    </div>
                                    <div class="panel-body">

                                         <table class="table table-striped table-bordered" id="example-4">
                                            <thead>
                                                <tr class="replace-inputs">
                                                    <th width="200px">编号</th>
                                                    <th>备份名称</th>
                                                    <th>备份内容</th>
                                                    <th>备份描述</th>
                                                    <th>备份时间</th>
                                                    <th>操作</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <c:forEach var="maintenance" items="${maintenances }">
                                                	<c:if test="${maintenance.maintenanceType == '0' }">
				                                    	<tr>
				                                            <td>${maintenance.ID }</td>
				                                            <td>${maintenance.maintenanceName }</td>
				                                            <td>${maintenance.maintenanceDescribe }</td>
				                                            <td>${maintenance.maintenanceDescribe }</td>
				                                            <td>${maintenance.maintenanceTime }</td>
				                                            <td>
	                                                        <a href="javascript:;" onclick="recover(${maintenance.ID}, this)" class="btn btn-secondary btn-sm btn-icon icon-left">
	                                                      	      恢复
	                                                        </a>
	                                                   		 </td>
				                                    	 </tr>
				                                     </c:if>
			                                    </c:forEach>
                                                
                                            </tbody>
                                            
                                        </table>

                                    </div>
                                </div>

                            </div>
                        </div>

                    </div>

                </div>

		<%--页脚 --%>
		<jsp:include page="/WEB-INF/jsps/footer.jsp"></jsp:include>
            </div>
        </div>

        <div class="page-loading-overlay">
            <div class="loader-2"></div>
        </div>

        <div class="modal fade" id="modal-1">
            <div class="modal-dialog">
                <div class="modal-content">

                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">提示信息</h4>
                    </div>

                    <div class="modal-body">
                        您确定要删除这条备份么？
                    </div>

                    <div class="modal-footer">
                        <button type="button" class="btn btn-white" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-info">删除</button>
                    </div>
                </div>
            </div>
        </div>

        <div class="modal fade" id="modal-7">
            <div class="modal-dialog">
                <div class="modal-content">

                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">备份详情</h4>
                    </div>

                    <div class="modal-body">
                        <div class="row">
                            <div class="col-md-6">

                                <div class="form-group">
                                    <label for="field-1" class="control-label">备份名称</label>
                                    <input type="text" class="form-control" id="field-1" placeholder="John" />
                                </div>

                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="field-1" class="control-label">备份时间</label>
                                    <input type="text" class="form-control" id="field-1" placeholder="John" disabled/>
                                </div>

                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-1" class="control-label">备份内容</label>
                                    <input type="text" class="form-control" id="tagsinput-1" data-role="tagsinput" value="Sample tag, Another great tag, Awesome!" disabled/>
                                </div>
                            </div>
                        </div>
                        
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-1" class="control-label">备份描述</label>
                                    <textarea class="form-control autogrow" cols="5" id="field-5" placeholder="I will grow as you enter new lines."></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="modal-footer">
                        <button type="button" class="btn btn-white" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-info">Save changes</button>
                    </div>
                    
                </div>
            </div>
        </div>

        <div class="modal fade" id="modal-6">
          <div class="modal-dialog">
          
            <form action='<c:url value="/addmaintenance.do" />' method="post">
				<input type="hidden" name="maintenanceType" value="1">
				<input type="hidden" id="maintenanceid" name="maintenanceId" value="">
				
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">填写恢复信息</h4>
                    </div>
					
                    <div class="modal-body">

                        <div class="row">
                            <div class="col-md-6">

                                <div class="form-group">
                                    <label for="field-1" class="control-label">恢复名称</label>

                                    <input type="text" class="form-control" id="field-1" placeholder="John"  name="maintenanceName">
                                </div>

                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-1" class="control-label">恢复内容</label>
                                    <textarea class="form-control autogrow" cols="5" id="field-5" placeholder="恢复内容"  name="maintenanceContent"></textarea>
                                </div>
                            </div>
                    </div>
                    
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-1" class="control-label">恢复描述</label>
                                    <textarea class="form-control autogrow" cols="5" id="field-5" placeholder="恢复描述"  name="maintenanceDescribe"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                        
                    <div class="modal-footer">
                        <button type="button" class="btn btn-white" data-dismiss="modal">返回</button>
                        <button type="submit" class="btn btn-info">恢复</button>
                    </div>
                </div>
              </form>
            </div>
        </div>
        <div class="modal fade" id="modal-8">
            <div class="modal-dialog">
                <div class="modal-content">

                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">填写备份信息</h4>
                    </div>

					<form action='<c:url value="/addmaintenance.do" />' method="post">
					  <input type="hidden" name="maintenanceType" value="0">
                      <div class="modal-body">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="field-1" class="control-label">备份名称</label>
                                    <input type="text" class="form-control" id="field-1" placeholder="数据库备份" name="maintenanceName">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-1" class="control-label">备份内容</label>                                    
                                     <input type="text" class="form-control" id="field-1" placeholder="John" name="maintenanceContent">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-1" class="control-label">备份描述</label>
                                    <textarea class="form-control autogrow" cols="5" id="field-5" placeholder="备份描述信息..." name="maintenanceDescribe"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="modal-footer">
                        <button type="button" class="btn btn-white" data-dismiss="modal">返回</button>
                        <button type=submit class="btn btn-info"                      
                        	><a>备份</a></button>
                    </div>
                   </form>
                </div>
            </div>
        </div>

        <%-- 尾部内容 --%>
        <jsp:include page="/WEB-INF/jsps/template_tail.jsp" />
        
        <link rel="stylesheet" href="assets/js/multiselect/css/multi-select.css">
        <link rel="stylesheet" href="assets/js/select2/select2.css">
        <link rel="stylesheet" href="assets/js/select2/select2-bootstrap.css">
        <script src="assets/js/datatables/js/jquery.dataTables.min.js"></script>
        <script src="assets/js/datatables/dataTables.bootstrap.js"></script>
        <script src="assets/js/datatables/yadcf/jquery.dataTables.yadcf.js"></script>
        <script src="assets/js/datatables/tabletools/dataTables.tableTools.min.js"></script>
        <script src="assets/js/select2/select2.min.js"></script>
        <script src="assets/js/jquery-ui.min.js"></script>
        <script src="assets/js/superadmin/maintenance.js"></script>

        <!--Specific JS for this page-->
        <script type="text/javascript">
            jQuery(document).ready(function($) {
                // Notifications
                setTimeout(function() {
                    var opts = {
                        "closeButton": true,
                        "debug": false,
                        "positionClass": "toast-top-right toast-default",
                        "toastClass": "black",
                        "onclick": null,
                        "showDuration": "100",
                        "hideDuration": "1000",
                        "timeOut": "5000",
                        "extendedTimeOut": "1000",
                        "showEasing": "swing",
                        "hideEasing": "linear",
                        "showMethod": "fadeIn",
                        "hideMethod": "fadeOut"
                    };
                }, 2000);
            });
            
           
            jQuery(document).ready(function($)
            {
                $("#s2example-3").select2({
                    placeholder: '暂无选择',
                    allowClear: true
                }).on('select2-open', function()
                {
                    // Adding Custom Scrollbar
                    $(this).data('select2').results.addClass('overflow-hidden').perfectScrollbar();
                });
                
            });
            
            jQuery(document).ready(function($) {
                $("#example-4").dataTable().yadcf([{
                    column_number: 0,   
                }, {
                    column_number: 1,
                    filter_type: 'text'
                }, {
                    column_number: 2,
                    filter_type: 'text'
                }, {
                    column_number: 3,
                    filter_type: 'text'
                }, {
                    column_number: 4,
                    filter_type: 'text'
                }, ]);           
            });
            
            jQuery(document).ready(function($) {
                $("#example-3").dataTable().yadcf([{
                    column_number: 0
                }, {
                    column_number: 1,
                    filter_type: 'text'
                }, {
                    column_number: 2,
                    filter_type: 'text'
                }, {
                    column_number: 3,
                    filter_type: 'text'    
                }, {
                    column_number: 4,
                    filter_type: 'text'  
                },  ]);
            });
            
            jQuery(document).ready(function($)
                    {
                        $("#s2example-2").select2({
                            placeholder: 'Choose your favorite US Countries',
                            allowClear: true
                        }).on('select2-open', function()
                        {
                            $(this).data('select2').results.addClass('overflow-hidden').perfectScrollbar();
                        });
                        
                    });
        </script>
        </script>
    </body>

</html>